﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Client.工具类;
namespace Client.窗体
{
	
	public partial class Setting : Form
	{
		const string cfg = "cfg.ini";
		Config cf;
		public Setting()
		{
			InitializeComponent();
		}

		private void Setting_Load(object sender, EventArgs e)
		{

			 cf = new Config(cfg);
			textBox1.InputText= cf.get("IP");
				textBox2.InputText = cf.get("P1");
			textBox3.InputText = cf.get("P2");
			textBox4.InputText = cf.get("Token");
			textBox5.InputText = Application.StartupPath + @"\MusicCache";

		}

		

		private void ucBtnImg4_BtnClick(object sender, EventArgs e)
		{

			cf.set("IP", textBox1.InputText);
			cf.set("P1", textBox2.InputText);
			cf.set("P2", textBox3.InputText);
			cf.set("Token", textBox4.InputText);
			cf.save();
			MessageBox.Show("保存成功");
		}

		private void textBox1_TextChanged(object sender, EventArgs e)
		{

		}

		private void ucBtnImg1_BtnClick(object sender, EventArgs e)
		{
			if (Directory.Exists(textBox5.InputText))
			{

				System.Diagnostics.Process.Start(textBox5.InputText);
			}
		}

		private void textBox5_TextChanged(object sender, EventArgs e)
		{

		}

		private void ucBtnImg2_BtnClick(object sender, EventArgs e)
		{
			licenses licenses = new licenses();

			licenses.ShowDialog();
		}
	}
}
